package com.hinnotek.amoeba.repo

import com.hinnotek.amoeba.api.ApiService
import com.hinnotek.amoeba.base.BaseBean
import com.hinnotek.amoeba.bean.old.CompanyPurchaseByCompanyPurchaseIdBean
import com.hinnotek.amoeba.bean.old.CompanyPurchaseByUserIdBean
import com.hinnotek.amoeba.bean.old.PtCustomerProjectBean
import com.hinnotek.amoeba.bean.old.PtProjectDetailBean
import com.lee.common.base.BaseRepository
import com.lee.common.network.net.StateLiveData
import okhttp3.RequestBody
import javax.inject.Inject

class AmibaCustomerRepo @Inject constructor(private val service: ApiService) : BaseRepository() {

    /**
     * app端获取合同列表分页接口
     */
    suspend fun addProject(body: RequestBody, stateLiveData: StateLiveData<BaseBean>) {
        executeResp({ service.addProject(body) }, stateLiveData)
    }

    suspend fun addCustomer(customerName: String, orgId: Int, createUser: String, stateLiveData: StateLiveData<BaseBean>) {
        executeResp({ service.addCustomer(customerName,orgId,createUser) }, stateLiveData)
    }

    suspend fun getCustomerProjectById(amibaCustomerProjectId: Int, stateLiveData: StateLiveData<PtProjectDetailBean>) {
        executeResp({ service.getCustomerProjectById(amibaCustomerProjectId) }, stateLiveData)
    }

    suspend fun getProjectPageByCustomerId(customerId: Int, pageNo: Int, pageSize: Int, stateLiveData: StateLiveData<MutableList<PtCustomerProjectBean>>) {
        executeResp({ service.getProjectPageByCustomerId(customerId,pageNo,pageSize) }, stateLiveData)
    }

    suspend fun addCompanyPurchase(body: RequestBody, stateLiveData: StateLiveData<BaseBean>) {
        executeResp({ service.addCompanyPurchase(body) }, stateLiveData)
    }

    suspend fun getCompanyPurchaseByCompanyPurchaseId(companyPurchaseId: Int, stateLiveData: StateLiveData<CompanyPurchaseByCompanyPurchaseIdBean>) {
        executeResp({ service.getCompanyPurchaseByCompanyPurchaseId(companyPurchaseId) }, stateLiveData)
    }

    suspend fun getCompanyPurchaseByUserId(applyUserId: Int, pageNo: Int, pageSize: Int, stateLiveData: StateLiveData<MutableList<CompanyPurchaseByUserIdBean>>) {
        executeResp({ service.getCompanyPurchaseByUserId(applyUserId,pageNo,pageSize) }, stateLiveData)
    }

}